﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CDB.LinqModel.Data;
using CDB.LinqData;
using CDB.LinqModel;

public partial class controls_userNavigation : System.Web.UI.UserControl
{
    #region Variable Declaration
    IDataRepository _dataObject = new DataRepository();
    User user;
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] != null)
            buildUserNavigation(Session["User"].ToString());
        else
            Response.Redirect("default.aspx");
        
    }
    public void buildUserNavigation(string userName)
    {
        User nUser = new User(_dataObject);
        nUser.UserName = userName;
        nUser.GetUserByUserName();

        if (nUser.Id != 0)
        {
            if (Request.RawUrl.ToLower().Contains("profile.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='active ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("myaccount.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='active ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("addproperty.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='active ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("addarchitects.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='active ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='active ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("addbuilders.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='active ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='active ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("viewproperties.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='active ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='ease'>Payment Details</a></li>";
            }
            if (Request.RawUrl.ToLower().Contains("mypayment.aspx"))
            {
                ULuserNavigation.InnerHtml = "<li><a href='myAccount.aspx' class='ease'>Dashboard</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='editProfile.aspx' class='ease'>Edit Profile</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='addProperty.aspx' class='ease'>Add Property</a></li>";
                ULuserNavigation.InnerHtml += "<li><a href='viewProperties.aspx' class='ease'>View Property</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Architectural Only") || nUser.ServiceRequired.Trim().Equals("Sanctions & Permit"))
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Construction Only"))
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                if (nUser.ServiceRequired.Trim().Equals("Complete Package"))
                {
                    ULuserNavigation.InnerHtml += "<li><a href='addArchitects.aspx' class='ease'>View Architects</a></li>";
                    ULuserNavigation.InnerHtml += "<li><a href='addBuilders.aspx' class='ease'>View Contractors</a></li>";
                }
                ULuserNavigation.InnerHtml += "<li><a href='myPayment.aspx' class='active ease'>Payment Details</a></li>";
            }
        }
    }
}